<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>添加页面</title>
    <th:block th:include="material/core/resources::headers"/>
</head>

<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form" id="McFrom" name="McFrom" th:object="${Mc}">
            <div class="layui-form-item">
                <label for="id" class="layui-form-label">
                    <span class="x-red"></span>物料编号：
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="id" name="id" required=""
                           autocomplete="off" class="layui-input" th:value="*{id}">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="task" class="layui-form-label">
                    <span class="x-red"></span>作业编号：
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="task" name="task" required=""
                           autocomplete="off" class="layui-input" th:value="*{task}">
                </div>
            </div>

            <div class="layui-form-item">
                <label for="info" class="layui-form-label">
                    <span class="x-red"></span>物料：
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="info" name="info" required=""
                           autocomplete="off" class="layui-input" th:value="*{materialInfo}">
                </div>
            </div>


            <div class="layui-form-item">
                <label for="consumeQuantity" class="layui-form-label">
                    <span class="x-red"></span>剩余数量：
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="consumeQuantity" name="consumeQuantity" required=""
                           autocomplete="off" class="layui-input" th:value="*{consumeQuantity}">
                </div>
            </div>

            <div class="layui-form-item">
                <label for="date" class="layui-form-label">
                    <span class="x-red"></span>时间：
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="date" name="date" required=""
                           autocomplete="off" class="layui-input" th:value="*{date}">
                </div>
            </div>

            <div class="layui-form-item">
                <label for="sender" class="layui-form-label">
                    <span class="x-red"></span>发送人：
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="sender" name="sender" required=""
                           autocomplete="off" class="layui-input" th:value="*{sender}">
                </div>
            </div>

            <div class="layui-form-item">
                <label for="receiver" class="layui-form-label">
                    <span class="x-red"></span>接收人：
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="receiver" name="receiver" required=""
                           autocomplete="off" class="layui-input" th:value="*{receiver}">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="remark" class="layui-form-label">
                    <span class="x-red"></span>备注：
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="remark" name="remark" required=""
                           autocomplete="off" class="layui-input" th:value="*{remark}">
                </div>
            </div>


            <div class="layui-form-item" style="padding-left: 110px">
                <button class="layui-btn" lay-filter="update" lay-submit="">
                    修改
                </button>
                <button class="layui-btn" type="reset">
                    重置
                </button>
            </div>

        </form>

    </div>
</div>

</body>

<script>layui.use(['form', 'layer', 'jquery'],
    function () {
        const $ = layui.jquery;
        const form = layui.form, layer = layui.layer;
        form.on('submit(update)',
            function (data) {
                $.ajax({
                    url: "/mc/updateMc",
                    type: "post",
                    data: data.field,
                    success(res) {
                        if (res.success) {
                            layer.alert("修改成功啊🐇", {
                                    icon: 6
                                },
                                function () {
                                    xadmin.close();
                                    xadmin.father_reload();
                                });
                        } else {
                            layer.msg(res.msg)
                        }
                    }
                })
                return false;
            });
    });
</script>

</html>